﻿using System;
using System.Collections;
using Huirui.Cavan.Domain.MainBoundedContext.SystemModule;
using System.Collections.Generic;
using Huirui.Cavan.Domain.Seedwork;
using Huirui.Cavan.Domain.MainBoundedContext.StockModule;

namespace Huirui.Cavan.Domain.MainBoundedContext.PurchaseModule
{
    #region Purchase

    /// <summary>
    /// Purchase object for NHibernate mapped table 'Purchase'.
    /// </summary>
    [Serializable]
    public class Purchase : Persistent<string>
    {
        #region Member Variables

        protected DateTime _purchaseDate;
        protected Project _project;
        protected Supplier _supplier;
        protected string _receivingNumber;
        protected string _currency;
        protected decimal _currencyRate;
        protected decimal _taxRate;
        protected string _supplierInvoiceNumber;
        protected string _deliveryAddress;
        protected string _remark;
        protected string _invoiceDescription;
        protected decimal _discount;
        protected decimal _cost;
        protected string _contact;
        protected string _contactTelephone;
        protected SystemIdentifier.PayType _payType;
        protected PurchaseIdentifier.PayCondition _payCondition;
        protected DateTime? _payDeadline;
        protected Corporation _corporation;
        protected Employee _purchaseEmployee;
        protected WareHouse _wareHouse;
        protected PurchaseOrder _purchaseOrder;
        protected StockInOut _stockInOut;

        #endregion

        #region Constructors

        public Purchase() { }

        public Purchase(string id, DateTime purchaseDate, Project project, Supplier supplier, string receivingNumber, string currency, decimal currencyRate, decimal taxRate, 
            string supplierInvoiceNumber, string deliveryAddress, string remark, string invoiceDescription, decimal discount, decimal cost, 
            SystemIdentifier.PayType payType, PurchaseIdentifier.PayCondition payCondition, DateTime? payDeadline, DateTime createDate, DateTime modifyDate,
            int editUser, Corporation corporation, Employee purchaseEmployee, PurchaseOrder purchaseOrder, WareHouse wareHouse, string contact, string contactTelephone)
        {
            this.Id = id;
            this._purchaseDate = purchaseDate;
            this._project = project;
            this._supplier = supplier;
            this._receivingNumber = receivingNumber;
            this._currency = currency;
            this._currencyRate = currencyRate;
            this._supplierInvoiceNumber = supplierInvoiceNumber;
            this._deliveryAddress = deliveryAddress;
            this._remark = remark;
            this._invoiceDescription = invoiceDescription;
            this._createDate = createDate;
            this._modifyDate = modifyDate;
            this._editUser = editUser;
            this._corporation = corporation;
            this._purchaseEmployee = purchaseEmployee;
            this._purchaseOrder = purchaseOrder;
            this._discount = discount;
            this._payType = payType;
            this._payCondition = payCondition;
            this._payDeadline = payDeadline;
            this._cost = cost;
            this._contact = contact;
            this._contactTelephone = contactTelephone;
            this._wareHouse = wareHouse;
            this._taxRate = taxRate;
        }

        #endregion

        #region Public Properties


        public virtual DateTime PurchaseDate
        {
            get { return _purchaseDate; }
            set { _purchaseDate = value; }
        }

        public virtual Project Project
        {
            get { return _project; }
            set { _project = value; }
        }

        public virtual Supplier Supplier
        {
            get { return _supplier; }
            set { _supplier = value; }
        }

        public virtual string ReceivingNumber
        {
            get { return _receivingNumber; }
            set
            {
                if (value != null && value.Length > 100)
                    throw new ArgumentOutOfRangeException("Invalid value for ReceivingNumber", value, value.ToString());
                _receivingNumber = value;
            }
        }

        public virtual string Currency
        {
            get { return _currency; }
            set
            {
                if (value != null && value.Length > 20)
                    throw new ArgumentOutOfRangeException("Invalid value for Currency", value, value.ToString());
                _currency = value;
            }
        }

        public virtual decimal CurrencyRate
        {
            get { return _currencyRate; }
            set { _currencyRate = value; }
        }

        public virtual decimal TaxRate
        {
            get { return _taxRate; }
            set { _taxRate = value; }
        }

        public virtual string SupplierInvoiceNumber
        {
            get { return _supplierInvoiceNumber; }
            set
            {
                if (value != null && value.Length > 100)
                    throw new ArgumentOutOfRangeException("Invalid value for SupplierInvoiceNumber", value, value.ToString());
                _supplierInvoiceNumber = value;
            }
        }

        public virtual string DeliveryAddress
        {
            get { return _deliveryAddress; }
            set
            {
                if (value != null && value.Length > 200)
                    throw new ArgumentOutOfRangeException("Invalid value for DeliveryAddress", value, value.ToString());
                _deliveryAddress = value;
            }
        }

        public virtual string Remark
        {
            get { return _remark; }
            set
            {
                _remark = value;
            }
        }

        public virtual string InvoiceDescription
        {
            get { return _invoiceDescription; }
            set
            {
                _invoiceDescription = value;
            }
        }

        public virtual SystemIdentifier.PayType PayType
        {
            get { return _payType; }
            set
            {
                _payType = value;
            }
        }

        public virtual PurchaseIdentifier.PayCondition PayCondition
        {
            get { return _payCondition; }
            set
            {
                _payCondition = value;
            }
        }

        public virtual Decimal Discount
        {
            get { return _discount; }
            set
            {
                _discount = value;
            }
        }

        public virtual decimal Cost
        {
            get { return _cost; }
            set { _cost = value; }
        }

        public virtual DateTime? PayDeadline
        {
            get { return _payDeadline; }
            set
            {
                _payDeadline = value;
            }
        }

        public virtual string Contact
        {
            get { return _contact; }
            set
            {
                _contact = value;
            }
        }

        public virtual string ContactTelephone
        {
            get { return _contactTelephone; }
            set
            {
                _contactTelephone = value;
            }
        }

        public virtual Corporation Corporation
        {
            get { return _corporation; }
            set { _corporation = value; }
        }

        public virtual Employee PurchaseEmployee
        {
            get { return _purchaseEmployee; }
            set { _purchaseEmployee = value; }
        }

        public virtual WareHouse WareHouse
        {
            get { return _wareHouse; }
            set { _wareHouse = value; }
        }

        public virtual PurchaseOrder PurchaseOrder
        {
            get { return _purchaseOrder; }
            set { _purchaseOrder = value; }
        }

        public virtual StockInOut StockInOut
        {
            get { return _stockInOut; }
            set { _stockInOut = value; }
        }

        #endregion
    }
    #endregion
}